package com.xzh.springCloud.controller;

import com.xzh.springCloud.entity.Result;
import com.xzh.springCloud.service.StorageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: zhiHong
 * @CreateTime: 2023-08-31 22:44
 * @Description:
 */
@RestController
public class StorageController {
    @Resource
    private StorageService storageService;

    @PostMapping("/storage/reduce")
    public Result reduce(@RequestParam("productId") Long productId, @RequestParam("amount") Integer amount) {
        storageService.reduce(productId, amount);
        return Result.success("库存扣除成功", null);
    }
}
